
%include 'C:\Users\maggi\Documents\Manuscript\Work from home\Programs\WFH.sas'; *call in the datastep codes;

**********************************************************************************************
                                        TABLE 2
********************************************************************************************** ;

data table2;
set wellbeing;

format work_home2018e work_home2018e. race22018c race22018c. age_cat2018c age_cat2018c. gender2018 gender2018c. mart_status2018c mart_status2018c. educ2018c educ2018c. 
home2018c home2018c. no_animal2018c no_animal2018c. work_hours2018c work_hours2018c.;

/*A. 5-category of WFH*/
%macro linear(outcome);
proc glm data=table2;
class work_home2018e race22018c age_cat2018c gender2018(ref='male') mart_status2018c educ2018c home2018c no_animal2018c work_hours2018c/ref=first;
model &outcome.= work_home2018e age_cat2018c gender2018 race22018c mart_status2018c educ2018c home2018c depressed2018z physhlth2018z 
                 n_children2018z n_elders2018z no_animal2018c purpose2018z work_hours2018c w_meaning2018z w_recognized2018z w_team2018z 
                 distracted2018_rz w_productive2018z wkfamilyconfl2018z jobsatis2018z /solution clparm; 
title "&outcome.";
run;
%mend;

%linear(outcome=distracted2019_rz);
%linear(outcome=w_productive2019z);
%linear(outcome=wkfamilyconfl2019z);
%linear(outcome=jobsatis2019z);
run;

/*B. 3-category of WFH*/
%macro linear(outcome);
proc glm data=table2;
class work_home2018d race22018c age_cat2018c gender2018(ref='male') mart_status2018c educ2018c home2018c no_animal2018c work_hours2018c/ref=first;
model &outcome.= work_home2018d age_cat2018c gender2018 race22018c mart_status2018c educ2018c home2018c depressed2018z physhlth2018z 
                 n_children2018z n_elders2018z no_animal2018c purpose2018z work_hours2018c w_meaning2018z w_recognized2018z w_team2018z 
                 distracted2018_rz w_productive2018z wkfamilyconfl2018z jobsatis2018z /solution clparm; 
title "&outcome.";
run;
%mend;

%linear(outcome=distracted2019_rz);
%linear(outcome=w_productive2019z);
%linear(outcome=wkfamilyconfl2019z);
%linear(outcome=jobsatis2019z);
run;

/*C. 4-category of WFH*/
%macro linear(outcome);
proc glm data=table2;
class work_home2018c race22018c age_cat2018c gender2018(ref='male') mart_status2018c educ2018c home2018c no_animal2018c work_hours2018c/ref=first;
model &outcome.= work_home2018c age_cat2018c gender2018 race22018c mart_status2018c educ2018c home2018c depressed2018z physhlth2018z 
                 n_children2018z n_elders2018z no_animal2018c purpose2018z work_hours2018c w_meaning2018z w_recognized2018z w_team2018z 
                 distracted2018_rz w_productive2018z wkfamilyconfl2018z jobsatis2018z /solution clparm; 
title "&outcome.";
run;
%mend;

%linear(outcome=distracted2019_rz);
%linear(outcome=w_productive2019z);
%linear(outcome=wkfamilyconfl2019z);
%linear(outcome=jobsatis2019z);
run;



